<template>
  <div>
    <p ref="elemRef">我是一行文字</p>
  </div>
</template>

<script>
import {
  onMounted,
  ref
} from 'vue'
export default {
  name: 'RefTemplate',
  setup() {
    const elemRef = ref(null) // 获取dom结构

    onMounted(() => {
      console.log('ref tempalte', elemRef.value.innerHTML, elemRef.value)
    })

    return {
      elemRef
    }
  }
}
</script>